package com.pro.control;

import com.pro.entity.AuditLog;
import com.pro.entity.JsonData;
import com.pro.service.AuditLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: AuditLogController
 * @Author: 笑笑
 * @DATE: 2021/11/29
 * @TIME: 下午 08:09
 */
@RestController
@RequestMapping("/AuditLog")
public class AuditLogController {
    @Autowired
    private AuditLogService auditLogService;

    //查询所有审核信息
    @RequestMapping("/getAllTable")
    public JsonData getAllTable(AuditLog autowired){
        List<AuditLog> allTable = auditLogService.getAllTable(autowired);
        return allTable.size() > 0 ? JsonData.buildSuccess(allTable) : JsonData.buildError("没有查找到");
    }

    //添加一条审核信息
    @RequestMapping("/addAuditLog")
    public JsonData addAuditLog(AuditLog autowired){
        Boolean aBoolean = auditLogService.addAuditLog(autowired);
        return aBoolean ? JsonData.buildSuccess(aBoolean) : JsonData.buildError("添加失败");
    }
}
